import React from 'react';
import { IconProps } from './interface';
import classNames from 'classnames';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

/**
 * Icon组件：对FontAwesomeIcon进行二次封装
 * @param props 
 * @returns 
 */
const Icon: React.FC<IconProps> = (props) => {

    const { className, theme = 'primary', ...restProps } = props;

    const classes = classNames('kd-icon', className, {
        [`kd-icon-${theme}`]: theme,
    })

    return (
        <FontAwesomeIcon className={classes} {...restProps} />
    );
};

export default Icon;